Repository navigation
fix(core): harden checkout and refund safety - #115
alexasomba wants to merge 4 commits into
Conversation
cavewebs
left a comment
There was a problem hiding this comment.
The tax guard and the refund idempotency ledger look great.
One change before I merge it: please do not mint a new refundRequestId on every amount or reason keystroke. If the first response is dropped and the merchant then edits the reason, the next submit is a new id and can create a second refund. Keep the same id until the attempt succeeds or the provider has definitely failed, so a retry stays idempotent.
Once that is in, I'll merge this before #107.
|
@cavewebs, could you take another look at #115 when you have a chance? Commit The requested Flutterwave currency fix is also up on #107 in |
Two small, independent core safety fixes from the Flutterwave parity review, combined so the stack has one fewer PR. No reviews yet, so nothing is lost by consolidating.
1. Refuse
stripe_taxwith a non-Stripe providertaxMode: "stripe_tax"defers tax calculation to Stripe: core returns zero tax and sendsautomaticTax: true. A provider that ignoresautomatic_taxwould charge the pre-tax total.checkout/create-sessionnow returns409 stripe_tax_requires_stripeand asks the merchant to switch to flat/table or to Stripe.2. Harden refund idempotency
The admin refund route generated a fresh
refund:${orderId}:${randomId()}on every click. If the provider accepted the refund but the response was lost, a retry could refund twice.admin/orders/refundaccepts arefundRequestId; the UI generates one per attempt and reuses it if the request throws.refundOrderreturns the recorded refund for a repeated request id instead of calling the provider again.Tests
stripe_taxrefusal + flat-tax pass-through; same-id refund calls the provider once; a different id is a new refund; an empty id is rejected.upstream/main, 0 failures.